﻿<controls:CustomWindow x:Class="CDC.SampleShell.Presentation.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:p="clr-namespace:CDC.SampleShell.Presentation.Properties"
        xmlns:controls="clr-namespace:CDC.SampleShell.Presentation.Controls"
        xmlns:content="clr-namespace:CDC.SampleShell.Presentation.Content"
        SnapsToDevicePixels="True"
        MinWidth="656" MinHeight="515"
        Title="{Binding Source={x:Static p:Settings.Default}, Path=AppName, Mode=OneWay}" Height="600" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!-- tab buttons -->
        <Border Grid.Row="0" Background="Transparent" BorderBrush="{StaticResource ThemeBrush}" BorderThickness="0, 0, 0, 1" Padding="6">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="10, 0, 0, 0" TextBlock.FontSize="14" >
                    <Button 
                        Style="{StaticResource TabButtonStyle}" 
                        Margin="0, 0, 14, 0" 
                        Command="{Binding SwitchViewCommand}"
                        CommandParameter="Home"
                        Content="Home" />

                    <Button 
                        Style="{StaticResource TabButtonStyle}" 
                        Margin="0, 0, 14, 0" 
                        Command="{Binding SwitchViewCommand}"
                        CommandParameter="Records"
                        Content="Data" />

                    <Button 
                        Style="{StaticResource TabButtonStyle}" 
                        Margin="0, 0, 14, 0" 
                        Command="{Binding SwitchViewCommand}"
                        CommandParameter="Import"
                        Content="Import" />

                    <Button 
                        Style="{StaticResource TabButtonStyle}" 
                        Margin="0, 0, 14, 0" 
                        Command="{Binding SwitchViewCommand}"
                        CommandParameter="Export"
                        Content="Export" />

                    <Button 
                        Style="{StaticResource TabButtonStyle}" 
                        Margin="0, 0, 14, 0" 
                        Command="{Binding SwitchViewCommand}"
                        CommandParameter="Reports"
                        Content="Reports" />
                
                </StackPanel>
                
                <StackPanel Grid.Column="1" HorizontalAlignment="Right" Margin="10, 0, 20, 0">
                    <Path Width="18" Height="18" Stretch="Fill" Fill="White" Data="F1 M 38,23.5C 38.8643,23.5 39.7109,23.5756 40.5337,23.7206L 42.6275,18.5381L 48.1901,20.787L 46.0964,25.9692C 47.6473,27.0149 48.9851,28.3527 50.0308,29.9036L 55.213,27.8099L 57.4619,33.3725L 52.2794,35.4664C 52.4244,36.2891 52.5,37.1357 52.5,38C 52.5,38.8643 52.4244,39.7109 52.2794,40.5337L 57.4619,42.6275L 55.213,48.1901L 50.0308,46.0964C 49.0795,47.5073 47.8865,48.7418 46.5112,49.7405L 48.7844,54.8462L 43.3041,57.2891L 41.0307,52.1828C 40.0533,52.3906 39.0394,52.5 38,52.5C 37.1357,52.5 36.2891,52.4244 35.4664,52.2794L 33.3725,57.462L 27.8099,55.213L 29.9036,50.0309C 28.3527,48.9851 27.0149,47.6473 25.9691,46.0964L 20.787,48.1901L 18.538,42.6275L 23.7206,40.5336C 23.5756,39.7109 23.5,38.8643 23.5,38C 23.5,37.1357 23.5756,36.2891 23.7206,35.4664L 18.538,33.3725L 20.787,27.8099L 25.9691,29.9036C 26.9205,28.4927 28.1135,27.2582 29.4889,26.2594L 27.2157,21.1537L 32.6959,18.7109L 34.9694,23.8172C 35.9468,23.6094 36.9606,23.5 38,23.5 Z M 38,28C 32.4771,28 28,32.4772 28,38C 28,43.5229 32.4771,48 38,48C 43.5228,48 48,43.5229 48,38C 48,32.4772 43.5228,28 38,28 Z "/>
                    
                </StackPanel>
            </Grid>
        </Border>

        <!-- home -->
        <content:HomeTab Grid.Row="1" Visibility="{Binding ViewShowing, Converter={StaticResource TabDisplayConverter}, ConverterParameter='Home', FallbackValue=Collapsed}">
            <content:HomeTab.Style>
                <Style TargetType="{x:Type content:HomeTab}">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                        Storyboard.TargetProperty="Opacity"
                        From="0.3" To="1.0" Duration="0:0:0.3"  />
                                    </Storyboard>
                                </BeginStoryboard>

                                <BeginStoryboard>
                                    <Storyboard >
                                        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" BeginTime="00:00:00" DecelerationRatio="0.5">
                                            <SplineThicknessKeyFrame KeyTime="0:0:0" Value="-60, 0,60,0" />
                                            <SplineThicknessKeyFrame KeyTime="0:0:0.3" Value="0, 0,0,0" />
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </content:HomeTab.Style>
        </content:HomeTab>

        <!-- import -->
        <content:ImportTab Grid.Row="1" 
                           Background="Red"
                           Visibility="{Binding ViewShowing, Converter={StaticResource TabDisplayConverter}, ConverterParameter='Import', FallbackValue=Collapsed}">
            <content:ImportTab.Style>
                <Style TargetType="{x:Type content:ImportTab}">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                        Storyboard.TargetProperty="Opacity"
                        From="0.3" To="1.0" Duration="0:0:0.3"  />
                                    </Storyboard>
                                </BeginStoryboard>

                                <BeginStoryboard>
                                    <Storyboard >
                                        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" BeginTime="00:00:00" DecelerationRatio="0.5">
                                            <SplineThicknessKeyFrame KeyTime="0:0:0" Value="-60, 0,60,0" />
                                            <SplineThicknessKeyFrame KeyTime="0:0:0.3" Value="0, 0,0,0" />
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </content:ImportTab.Style>
                    
        </content:ImportTab>

        <!-- export -->
        <content:ExportTab Grid.Row="1" 
                           Background="Red"
                           Visibility="{Binding ViewShowing, Converter={StaticResource TabDisplayConverter}, ConverterParameter='Export', FallbackValue=Collapsed}">
            <content:ExportTab.Style>
                <Style TargetType="{x:Type content:ExportTab}">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                        Storyboard.TargetProperty="Opacity"
                        From="0.3" To="1.0" Duration="0:0:0.3"  />
                                    </Storyboard>
                                </BeginStoryboard>

                                <BeginStoryboard>
                                    <Storyboard >
                                        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" BeginTime="00:00:00" DecelerationRatio="0.5">
                                            <SplineThicknessKeyFrame KeyTime="0:0:0" Value="-60, 0,60,0" />
                                            <SplineThicknessKeyFrame KeyTime="0:0:0.3" Value="0, 0,0,0" />
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </content:ExportTab.Style>

        </content:ExportTab>

        <!-- anareportslysis -->
        <content:ReportsTab 
            x:Name="panelReports" 
            Grid.Row="1" 
            Visibility="{Binding ViewShowing, Converter={StaticResource TabDisplayConverter}, ConverterParameter='Reports', FallbackValue=Visible}" >
            <content:ReportsTab.Style>
                <Style TargetType="{x:Type content:ReportsTab}">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                        Storyboard.TargetProperty="Opacity"
                        From="0.0" To="1.0" Duration="0:0:0.3"  />
                                    </Storyboard>
                                </BeginStoryboard>

                                <BeginStoryboard>
                                    <Storyboard >
                                        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" BeginTime="00:00:00" DecelerationRatio="0.5">
                                            <SplineThicknessKeyFrame KeyTime="0:0:0" Value="-60, 0,60,0" />
                                            <SplineThicknessKeyFrame KeyTime="0:0:0.3" Value="0, 0,0,0" />
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </content:ReportsTab.Style>
        </content:ReportsTab>

        <!-- data entry -->
        <content:DataTab 
            x:Name="panelData" 
            Grid.Row="1" 
            Visibility="{Binding ViewShowing, Converter={StaticResource TabDisplayConverter}, ConverterParameter='Records', FallbackValue=Visible}" >
            <content:DataTab.Style>
                <Style TargetType="{x:Type content:DataTab}">
                    <Style.Triggers>
                        <Trigger Property="Visibility" Value="Visible">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation
                        Storyboard.TargetProperty="Opacity"
                        From="0.0" To="1.0" Duration="0:0:0.3"  />
                                    </Storyboard>
                                </BeginStoryboard>

                                <BeginStoryboard>
                                    <Storyboard >
                                        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" BeginTime="00:00:00" DecelerationRatio="0.5">
                                            <SplineThicknessKeyFrame KeyTime="0:0:0" Value="-60, 0,60,0" />
                                            <SplineThicknessKeyFrame KeyTime="0:0:0.3" Value="0, 0,0,0" />
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </content:DataTab.Style>
        </content:DataTab>

        <Border Grid.Row="2" Background="{StaticResource ThemeBrush}" Padding="4">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                
                <TextBlock Grid.Column="0" Foreground="White" Margin="10, 0, 0, 0">
                    Sample Shell (2015) Erik Knudsen
                </TextBlock>

                <TextBlock x:Name="tblockVersion" Grid.Column="1" Foreground="White" Margin="0, 0, 10, 0" HorizontalAlignment="Right" />
            </Grid>
        </Border>

        <DockPanel Grid.RowSpan="100" Grid.ColumnSpan="100" Background="#00000000" Visibility="{Binding IsProcessingRecords, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}">
            <controls:LoadingPanel Width="440" Height="249" >
                <controls:LoadingPanel.Effect>
                    <DropShadowEffect BlurRadius="15" Opacity="0.5" ShadowDepth="2" />
                </controls:LoadingPanel.Effect>
            </controls:LoadingPanel>
        </DockPanel>
    </Grid>
</controls:CustomWindow>
